<!-- @format -->

<!--延迟加载组件-->
<template>
    <span><slot v-if="initSuccess"></slot></span>
</template>
<script>
export default {
    name: 'pl-lazy',
    data() {
        return {
            initSuccess: false
        }
    },
    props: {
        time: {
            type: Number,
            required: true,
            default: 0
        }
    },
    created() {
        this.init()
    },
    methods: {
        init() {
            let _this = this
            setTimeout(function() {
                _this.initSuccess = true
            }, Number(_this.time || 0))
        }
    }
}
</script>
